package com.example.javaserve.controller;


import com.example.javaserve.entity.UserBaseInfo;
import com.example.javaserve.result.impl.SuccessResult;
import com.example.javaserve.result.Result;
import com.example.javaserve.service.impl.EmailServiceEz;
import com.example.javaserve.service.impl.UserCRUDImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.thymeleaf.context.Context;

import java.io.IOException;


/**
 * @projectName: MyGene
 * @package: com.example.mygene.controller
 * @className: UserController
 * @author: xxXPCSC
 * @description: TODO
 * @date: 2023/11/3 15:52
 * @version: 1.0
 **/
@Controller
public class UserController {

    @Autowired
    private EmailServiceEz emailServiceEz;


    @RequestMapping("/test")
    @ResponseBody
    public String userRegister(){
        return "123";
    }

    @PostMapping("/user/register_code")
    @ResponseBody
    public Result userRegister_code(@RequestParam(defaultValue = "default") String my_email) throws IOException {
        Context context = new Context();
        context.setVariable("code", 6666);
        emailServiceEz.send("2642385521@qq.com", "激活码模板邮件", context);

        return new SuccessResult();
    }


}
